<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link th:href="@{/css/shop.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/css/Sellerber.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/css/bkg_ui.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/font/css/font-awesome.min.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/js/jquery-1.9.1.min.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/js/jquery.cookie.}"></script>
    <script th:src="@{/js/shopFrame.js}" type="text/javascript"></script>
    <script th:src="@{/js/Sellerber.js}" type="text/javascript"></script>
    <script th:src="@{/js/layer/layer.js}" type="text/javascript"></script>
    <!--[if lt IE 9]>
    <script th:src="@{/js/html5shiv.js}" type="text/javascript"></script>
    <script th:src="@{/js/respond.min.js}"></script>
    <script th:src="@{/js/css3-mediaqueries.js}" type="text/javascript"></script>
    <![endif]-->
    <title>订单详细</title>
</head>

<body class="">
<div class="Interface_spacing clearfix">
    <div class="order_detailed" >
        <div class="order_number">
            订单编号：<b id="order_number_html" th:text="${map.p.content[0].orderNum}"></b>
            <span class="r_f" id="orderTime">下单时间：<label th:text="${map.p.content[0].orderTime}"></label></span>
        </div>
        <div class="order_content clearfix">
            <div class="Buyers_info margin-bottom clearfix">
                <ul>
                    <li><label class="title_name">收件人姓名：</label><span id="userName" th:text="${map.p.content[0].receiveName}">张小泉</span></li>
                    <li><label class="title_name">座位号：</label><span id="seatId" th:text="${mapChildOrder.seat.rownum}+行+${mapChildOrder.seat.columnnum}+列"></span></li>
                    <li><label class="title_name">备&nbsp;&nbsp;&nbsp;&nbsp;注：</label><span>随机</span></li>
                    <li class="address"><label class="title_name">买家地址：</label><span id="address" th:text="${map.p.content[0].receiveAddress}"></span></li>
                    <li><label class="title_name">联系电话：</label><span id="tel" th:text="${map.p.content[0].telephone}"></span></li>
                </ul>
            </div>
            <table class="table table_list table_striped  table-bordered">
                <thead>
                <tr>
                    <th>产品名称</th>
                    <th width="100">原价</th>
                    <th width="100">现价</th>
                    <th width="100">优惠</th>
                    <th width="50">数量</th>
                </tr>
                </thead>
                <tbody id="tbody" th:fragment="userinfo_refresh">
                <tr>
                    <td class="product_name text-align">
                        <a href="#" class="link_name">
                            <div class="l_f img">
                                <img th:src="${map.p.content[0].imgUrl}" width="80px" height="80px"/>
                            </div>
                            <div class="l_f content padding">
                                <p th:text="${map.p.content[0].commodityName}"></p>
                            </div>
                        </a>
                    </td>
                    <td th:text="${mapChildOrder.childOrder.commodityPrice}"></td>
                    <td th:text="${mapChildOrder.childOrder.disPrice}"></td>
                    <td th:text="${mapChildOrder.childOrder.commodityPrice-mapChildOrder.childOrder.disPrice}"></td>
                    <td th:text="${map.p.content[0].count}">1</td>
                </tr>
                </tbody>
            </table>
            <div class="order_info Buyers_info margin-sx clearfix">
                <ul>
                    <li>
                        <label class="title_name">支付状态：</label>
                        <span id="status" th:text="${map.p.content[0].status==0?'待支付':map.p.content[0].status==1?'待出票':map.p.content[0].status==2?'待收货':map.p.content[0].status==3?'已完成':map.p.content[0].status==4?'已取消':map.p.content[0].status==5?'已退款':'数据损毁'}"></span>
                    </li>
                    <li>
                        <label class="title_name">配送快递：</label>
                        <span id="deliverType" th:text="${map.p.content[0].deliverType==0?'快递':map.p.content[0].deliverType==0?'快递':map.p.content[0].deliverType==1?'现场自取':map.p.content[0].deliverType==2?'门店自取':map.p.content[0].deliverType==3?'电子票':'数据损毁'}"></span>
                    </li>
                    <li><label class="title_name">配送金额：</label><span th:text="${map.p.content[0].postage}"></span></li>
                    <li><label class="title_name">物流编号：</label><span id="order_logisticsNum_html" th:text="${map.p.content[0].logisticsNum}"></span></li>
                </ul>
            </div>
            <div class="Price clearfix">
                <a href="javascrpit:void()" class="btn button_btn bg-deep-blue margin-top" onclick="logistics_info()">物流信息</a>
                <a th:href="@{/mainOrder/selectMainOrderInfo}" class="btn button_btn bg-deep-blue margin-top" id="returnMainOrder">返回</a>
                <div class="right_Price">
                    <p><span class="Price_name">总价：</span><b class="font_size_das color_mu" id="totalPrice" th:text="${map.p.content[0].totalPrice}"></b></p>
                    <p><span class="Price_name">优惠：</span><b class="font_size color_mu" id="youhui" th:text="${mapChildOrder.childOrder.commodityPrice-mapChildOrder.childOrder.disPrice}"></b></p>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="logistics_info" id="logistics_info" style="display:none">
    <div class="track-rcol">
        <div class="track-list">
            <ul>
                <li class="first">
                    <i class="node-icon"></i>
                    <span class="time">2016-03-10 18:07:15</span>
                    <span class="txt">感谢您在京东购物，欢迎您再次光临！</span>
                </li>
                <li>
                    <i class="node-icon"></i>
                    <span class="time">2016-03-10 18:07:15</span>
                    <span class="txt">【京东到家】京东配送员【申国龙】已出发，联系电话【18410106883，感谢您的耐心等待，参加评价还能赢取京豆呦】</span>
                </li>
                <li>
                    <i class="node-icon"></i>
                    <span class="time">2016-03-10 18:07:15</span>
                    <span class="txt">感谢您在京东购物，欢迎您再次光临！</span>
                </li>
                <li>
                    <i class="node-icon"></i>
                    <span class="time">2016-03-10 18:07:15</span>
                    <span class="txt">感谢您在京东购物，欢迎您再次光临！</span>
                </li>
                <li>
                    <i class="node-icon"></i>
                    <span class="time">2016-03-10 18:07:15</span>
                    <span class="txt">感谢您在京东购物，欢迎您再次光临！</span>
                </li>
                <li>
                    <i class="node-icon"></i>
                    <span class="time">2016-03-10 18:07:15</span>
                    <span class="txt">感谢您在京东购物，欢迎您再次光临！</span>
                </li>
            </ul>
        </div>
    </div>
</div>
</body>
</html>
<script>
    /***********图片查看**********/
    function logistics_info() {
        layer.open({
            type: 1,
            title: '物流信息',
            maxmin: true,
            shadeClose: false, //点击遮罩关闭层
            area: ['600px', '400px'],
            content: $('#logistics_info'),
        });
    }


    /*******滚动条*******/
    /*$("body").niceScroll({
        cursorcolor:"#888888",
        cursoropacitymax:1,
        touchbehavior:false,
        cursorwidth:"5px",
        cursorborder:"0",
        cursorborderradius:"5px"
    });*/

    $(function () {
        var orderNum = $("#orderNum").val();
        $.ajax({
            url: "/childOrder/findChidlOrderByOrderNum",
            method: "POST",
            data: {
                orderNum: orderNum,
            },
            dataType: "json",
            success: function (data) {

                $.ajax({
                    url: "/mainOrder/selectMainOrderInfo",
                    method:"POST",
                    data:{
                        orderNum:orderNum,
                    },
                    dataType: "json",
                    success: function(data1){
                        $("#order_number_html").html(data.orderNum);
                        $("#seatId").html(data.seatId);

                        var a;
                        var status;
                        var deliverType;


                        /**
                         *时间戳转换为时间
                         */
                        function timestampToTime(timestamp) {
                            var date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
                            var Y = date.getFullYear() + '-';
                            var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                            var D = date.getDate() + ' ';
                            var h = date.getHours() + ':';
                            var m = date.getMinutes() + ':';
                            var s = date.getSeconds();
                            return Y+M+D+h+m+s;
                        }


                        $.each(data1.content,function (i,v) {

                            var totalPrice=v.postage;
                            totalPrice=totalPrice+(data.disPrice*v.count);
                            $("#totalPrice").html(totalPrice);
                            var youhui=0;
                            youhui=youhui+((data.commodityPrice)-(data.disPrice))*v.count;
                            $("#youhui").html(youhui);





                            if(v.status==0){
                                status="待支付";
                            }else  if(v.status==1){
                                status="待出票";
                            }else  if(v.status==2){
                                status="待收货";
                            }else  if(v.status==3){
                                status="已完成";
                            }else  if(v.status==4){
                                status="已取消";
                            }else  if(v.status==5){
                                status="已退款";
                            }

                            if(v.deliverType==0){
                                deliverType="快递";
                            }else if(v.deliverType==1){
                                deliverType="现场自取";
                            }else if(v.deliverType==2){
                                deliverType="门店自取";
                            }else if(v.deliverType==3){
                                deliverType="电子票";
                            }
                            $("#userName").html(v.userId);
                            $("#order_logisticsNum_html00").html(v.logisticsNum);
                            $("#orderTime").html(timestampToTime(v.orderTime));
                            $("#address").html(v.addressId);


                            a="<tr>"+
                                "<td class='product_name text-align'>"+
                                "<a href='#' class='link_name'>"+
                                "   <div class='l_f img'>"+
                                "   <img src='../products/p_55.jpg' width='80px' height='80px'/>"+
                                "   </div>"+
                                "   <div class='l_f content padding'>"+
                                "   <p>正宗福鼎特产祥利蜜汁鸡翅乡巴佬美味食品秘制鸡翅膀小吃</p>"+
                                "   </div>"+
                                "   </a>"+
                                "   </td>"+
                                "   <td>"+data.commodityPrice+"</td>"+
                                "   <td class='totalPrice'>"+data.disPrice+"</td>"+
                                "   <td class='youhui'>"+(data.commodityPrice-data.disPrice)+"</td>"+
                                "   <td>"+v.count+"</td>"+
                                "   </tr>";
                        })
                        $("#status").html(status);
                        $("#deliverType").html(deliverType);
                        $("#tbody").append(a);
                    }
                })
            }
        })

    })
</script>
